import { onMounted, onUnmounted } from "vue"



export function useEvent(target: any, event: any, callback: any) {
  // 一个组合式函数也可以挂靠在所属组件的生命周期上
  // 来启动和卸载副作用
  onMounted(() => target.addEventListener(event, callback))
  onUnmounted(() => target.removeEventListener(event, callback))
}